﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AMS.Configuration
{
    /// <summary>
    /// 视图信息
    /// </summary>
    public class ViewInfo
    {
        /// <summary>
        /// 名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 对应的数据库表或视图的名字
        /// </summary>
        public string DBName { get; set; }

        /// <summary>
        /// 其描述
        /// </summary>
        public string Caption { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateDateTime { get; set; }

        /// <summary>
        /// 所属的类别
        /// </summary>
        public string Category { get; set; }

        /// <summary>
        /// 列信息
        /// </summary>
        public List<ColumnInfo> Columns { get; set; }

        /// <summary>
        /// 获取显示的列信息
        /// </summary>
        /// <returns></returns>
        public List<ColumnInfo> GetDisplayColumns()
        {
            if (Columns == null)
            {
                return null;
            }

            List<ColumnInfo> displayColumns = new List<ColumnInfo>();
            foreach (ColumnInfo column in Columns)
            {
                if (column.IsDisplay)
                {
                    displayColumns.Add(column);
                }
            }

            return displayColumns;
        }
    }

}
